// eslint-disable-next-line
import { UserLayout, BasicLayout, BlankLayout , PageView } from '@/layouts'
import { bxAnaalyse } from '@/core/icons';
const brandId = process.env.VUE_APP_BRANDID

const RouteView = {
  name: 'RouteView',
  render: h => h('router-view')
}
export const asyncRouterMap = [
  {
    path: '/',
    name: 'index',
    component: BasicLayout,
    meta: { title: 'menu.home' },
    redirect: 'member/index',
    children: [
      // 会员信息管理
      {
        path: '/member',
        name: 'member',
        component: PageView,
        meta: { title: '会员信息' , keepAlive: false, icon: 'team', permission: [,'updateUserGrade','brandRegister','updateUserRelation','updateBlacklist','updateReceiverInfo']},
        children: [
          {
            path: '/member/register',
            name: 'memRegister',
            component: () => import('@/views/member/register'),
            meta: { title: '快速注册' , keepAlive: false, permission: ['brandRegister']}
          },
          {
            path: '/member/index',
            name: 'memberIndex',
            component: () => import('@/views/member/member'),
            meta: { title: '会员列表' , keepAlive: false, permission: ['updateUserGrade']}
          },
          {
            path: '/member/userAccount',
            name: 'memberUserAccount',
            component: () => import('@/views/member/userAccount'),
            meta: { title: '用户账户信息' , keepAlive: false, permission: ['queryUserAccount']}
          },
          // {
          //   path: '/power/updateUserRelation',
          //   name: 'updateUserRelation',
          //   component: () => import('@/views/power/updateUserRelation'),
          //   meta: { title: '修改用户上下级' , keepAlive: false, permission: ['updateUserRelation']}
          // },
          {
            path: '/member/updatePhone',
            name: 'updatePhone',
            component: () => import('@/views/member/updatePhone'),
            meta: { title: '更换手机号' , keepAlive: false, permission: ['updateUserPhone']}
          },
          // {
          //   path: '/member/delPhone',
          //   name: 'delPhone',
          //   component: () => import('@/views/member/delPhone'),
          //   meta: { title: '注销手机号' , keepAlive: false, permission: ['updateUserPhone']}
          // },
          {
            path: '/member/password',
            name: 'memPassword',
            component: () => import('@/views/member/password'),
            meta: { title: '修改密码' , keepAlive: false, permission: ['updatePassword']}
          },
          {
            path: '/member/black',
            name: 'memBlack',
            component: () => import('@/views/member/black'),
            meta: { title: '黑名单管理' , keepAlive: false, permission: ['updateBlacklist']}
          },
        ]
      },
      // 推广模式管理
     {
       path: '/product',
       name: 'product',
       redirect: '/product/grade',
       component: PageView,
       meta: { title: '推广模式管理' , keepAlive: false, icon: 'audit', permission: ['updateGradeProduct','updateWithdrawConfig','updateGradeUpConfig','checkRegisterTask','updateRecycleSpecTitle','updateRecycleClassify']},
       children: [
         {
           path: '/product/grade',
           name: 'grade',
           component: () => import('@/views/product/product'),
           meta: { title: '产品等级' , keepAlive: false, permission: ['queryGradeProduct','updateGradeProduct']}
         },
          //  {
          //    path: '/product/topUpConfig',
          //    name: 'topUpConfig',
          //    component: () => import('@/views/product/topUpConfig'),
          //    meta: { title: '充值配置' , keepAlive: false, permission: ['updateTopUpConfig']}
          //  },
        //  {
        //    path: '/product/upGrade',
        //    name: 'upGrade',
        //    component: () => import('@/views/product/upGrade'),
        //    meta: { title: '推广升级配置' , keepAlive: false, permission: ['updateGradeUpConfig']}
        //  },
        //  {
        //    path: '/product/awardModel',
        //    name: 'awardModel',
        //    component: () => import('@/views/product/awardModel/layout'),
        //    meta: { title: '层级奖励' , keepAlive: false, permission: ['queryAwardModelConfig','queryAwardModelNumberConfig']},
        //    redirect: '/product/awardModel/awards',
        //    children: [
        //      {
        //        path: '/product/awardModel/awards',
        //        name: 'awardModelAwards',
        //        component: () => import('@/views/product/awardModel/awards'),
        //       //  component: () => import('@/views/product/awardModel/awards/index copy.vue'),
        //        meta: { title: '层级奖励金额' , keepAlive: false, permission: ['queryAwardModelNumberConfig','updateAwardModelNumberConfig']}
        //      },
        //      {
        //        path: '/product/awardModel/config',
        //        name: 'awardModelConfig',
        //        component: () => import('@/views/product/awardModel/config'),
        //        meta: { title: '层级奖励配置' , keepAlive: false, permission: ['queryAwardModelConfig','updateAwardModelConfig']}
        //      },
        //    ]
        //  },
        ]
      },
      {
        path: '/pet',
        name: 'pet',
        component: PageView,
        meta: { title: '宠物管理' , keepAlive: false, icon: 'shop', permission: ['queryPetTravelOrderForm','queryPetServiceOrderForm','queryPetInfo','updatePetServiceSuggestCycle','updatePetReservationTime','updatePetServiceProject','updatePetBreed','updatePetSpecies','updatePetStoreManagerConfig','updatePetStore','updatePetTravelGoods','updatePetGoodsStock']},
        children: [
          {
            path: '/pet/travelOrder',
            name: 'petTravelOrder',
            component: () => import('@/views/pet/travelOrder'),
            meta: { title: '宠物旅游订单' , keepAlive: false, permission: ['queryPetTravelOrderForm']}
          },
          {
            path: '/pet/serviceOrder',
            name: 'petServiceOrder',
            component: () => import('@/views/pet/serviceOrder'),
            meta: { title: '宠物服务订单' , keepAlive: false, permission: ['queryPetServiceOrderForm']}
          },
          {
            path: '/pet/petInfo',
            name: 'petInfo',
            component: () => import('@/views/pet/petInfo'),
            meta: { title: '宠物信息列表' , keepAlive: false, permission: ['queryPetInfo']}
          },
          {
            path: '/pet/petGoods',
            name: 'petGoods',
            component: () => import('@/views/pet/goods'),
            meta: { title: '宠物旅游管理' , keepAlive: false, permission: ['updatePetTravelGoods']}
          },
          {
            path: '/pet/petGoodsStock',
            name: 'petGoodsStock',
            hidden: true,
            component: () => import('@/views/pet/goodsStock'),
            meta: { title: '宠物商品库存管理' , keepAlive: false, permission: ['updatePetGoodsStock']}
          },
          {
            path: '/pet/manager',
            name: 'petManager',
            component: () => import('@/views/pet/manager'),
            meta: { title: '门店管理员配置' , keepAlive: false, permission: ['updatePetStoreManagerConfig']}
          },
          {
            path: '/pet/petStore',
            name: 'petStore',
            component: () => import('@/views/pet/store'),
            meta: { title: '宠物门店列表' , keepAlive: false, permission: ['updatePetStore']}
          },
          {
            path: '/pet/petHealthInfo',
            name: 'petPetHealthInfo',
            hidden: true,
            component: () => import('@/views/pet/petHealthInfo'),
            meta: { title: '宠物健康信息' , keepAlive: false, permission: ['queryPetHealthInfo']}
          },
          {
            path: '/pet/vaccineRecord',
            name: 'petVaccineRecord',
            hidden: true,
            component: () => import('@/views/pet/vaccineRecord'),
            meta: { title: '宠物疫苗记录' , keepAlive: false, permission: ['queryPetVaccineRecord']}
          },
          {
            path: '/pet/petConfig',
            name: 'petPetConfig',
            component: () => import('@/views/pet/layout'),
            meta: { title: '宠物相关配置' , keepAlive: false, permission: ['updatePetServiceSuggestCycle','updatePetReservationTime','updatePetServiceProject','updatePetBreed','updatePetSpecies']},
            children: [
              {
                path: '/pet/petConfig/serviceSuggest',
                name: 'petPetConfigServiceSuggest',
                component: () => import('@/views/pet/petServiceSuggest'),
                meta: { title: '宠物服务建议周期' , keepAlive: false, permission: ['updatePetServiceSuggestCycle']}
              },
             {
               path: '/pet/petConfig/serviceProject',
               name: 'petPetConfigServiceProject',
               component: () => import('@/views/pet/project'),
               meta: { title: '宠物服务项目配置' , keepAlive: false, permission: ['updatePetServiceProject']}
             },
             {
               path: '/pet/petConfig/reserTime',
               name: 'petPetConfigReserTime',
               component: () => import('@/views/pet/reserTime'),
               meta: { title: '项目预约时间配置' , keepAlive: false, permission: ['updatePetReservationTime']}
             },
             {
               path: '/pet/petConfig/breed',
               name: 'petPetConfigBreed',
               component: () => import('@/views/pet/breed'),
               meta: { title: '项目品种配置' , keepAlive: false, permission: ['updatePetBreed']}
             },
             {
               path: '/pet/petConfig/specs',
               name: 'petPetConfigSpecs',
               component: () => import('@/views/pet/specs'),
               meta: { title: '项目种类配置' , keepAlive: false, permission: ['updatePetSpecies']}
             },
            ]
          }
        ]
      },
      // 交易查询
      {
        path: '/order',
        name: 'order',
        component: PageView,
        meta: { title: '订单管理' , keepAlive: false, icon: 'transaction', permission: ['queryTaskBatch','queryTaskSub','queryTransactionOrder','queryExternalReleaseOrderNotify','queryTopUpEvidence','checkTopUpEvidence','auditWithDrawOrder','queryWithDrawOrder','queryTaskDay','queryJTKUnionOrder','queryRecycleOrderForm']},
        children: [
          {
            path: '/order/transaction',
            name: 'transaction',
            component: () => import('@/views/order/transaction'),
            meta: { title: '订单明细' , keepAlive: false, permission: ['queryTransactionOrder']}
          },
          {
            path: '/order/transaction/orderPromise',
            name: 'orderPromise',
            hidden: true,
            component: () => import('@/views/order/transaction/orderPromise'),
            meta: { title: '异步回调查询' , keepAlive: false, permission: ['queryExternalReleaseOrderNotify']}
          },
          // {
          //   path: '/order/topUpOrder',
          //   name: 'topUpOrder',
          //   component: () => import('@/views/order/topUpOrder'),
          //   meta: { title: '充值订单管理' , keepAlive: false, permission: ['queryTopUpEvidence','checkTopUpEvidence']}
          // },
          {
            path: '/order/withdrawOrder',
            name: 'withdrawOrder',
            component: () => import('@/views/order/withdrawOrder'),
            meta: { title: '提现订单' , keepAlive: false, permission: ['auditWithDrawOrder','queryWithDrawOrder']}
          },
        ]
      },
      {
        path: '/brandManage',
        name: 'brandManage',
        redirect: '/brandManage/brandConfig',
        component: PageView,
        meta: { title: '运营管理' , keepAlive: false, icon: 'project', permission: ['updateBrandConfig','updatePayChannelGradeRateConfig','queryAwardModelConfig','queryAwardModelNumberConfig','queryCardChannelConfig','updateCardChannelConfig','upadteQuickChannelConfig','updateBrandAllChannelConfig','updateQuickUser']},
        children: [
          {
            path: '/brandManage/brandConfig',
            name: 'brandConfig',
            component: () => import('@/views/brandManage/brandConfig'),
            meta: { title: '品牌信息' , keepAlive: false, permission: ['queryBrandConfig','updateBrandConfig']}
          },
          {
            path: '/brandManage/news',
            name: 'news',
            component: () => import('@/views/brandManage/news/layout'),
            meta: { title: '活动新闻管理' , keepAlive: false, permission: ['queryBanner','updateBanner','queryNewsClassification']},
            redirect: '/brandManage/news/news',
            children: [
              {
                path: '/brandManage/news/news',
                name: 'brandManageNews',
                component: () => import('@/views/brandManage/news/news'),
                meta: { title: '活动新闻信息' , keepAlive: false, permission: ['queryBanner','updateBanner']}
              },
              {
                path: '/brandManage/news/classification',
                name: 'brandManageNewsClassification',
                component: () => import('@/views/brandManage/news/classification'),
                meta: { title: '活动分类配置' , keepAlive: false, permission: ['updateNewsClassification','queryNewsClassification']}
              },
            ]
          },
          {
            path: '/brandManage/channelConfig',
            name: 'channelConfig',
            component: () => import('@/views/brandManage/channelConfig'),
            meta: { title: '通道配置' , keepAlive: false, permission: ['queryBrandChannelConfig','updateBrandChannelConfig','updateAllChannelConfig']}
          },
          {
            path: '/rewardCenter/withdraw',
            name: 'rewardCenterWithdraw',
            component: () => import('@/views/product/withdraw'),
            meta: { title: '提现配置' , keepAlive: false, permission: ['updateWithdrawConfig',]}
          },
          {
            path: '/brandManage/wechatLoginConfig',
            name: 'wechatLoginConfig',
            component: () => import('@/views/brandManage/wechatLoginConfig'),
            meta: { title: '微信登录配置' , keepAlive: false, permission: ['updateWechatConfig']}
          },
          // {
          //   path: '/brandManage/payChatConfig',
          //   name: 'payChatConfig',
          //   component: () => import('@/views/brandManage/payChatConfig'),
          //   meta: { title: '微信支付配置' , keepAlive: false, permission: ['updateWebWechatAppId']}
          // },
          {
            path: '/brandManage/aliTransferAccount',
            name: 'aliTransferAccount',
            component: () => import('@/views/brandManage/aliTransferAccount'),
            meta: { title: '支付宝代付账户' , keepAlive: false, permission: ['queryBrandAliTransferAccount','updateBrandAliTransferAccount']}
          },
          {
            path: '/brandManage/topUpAccount',
            name: 'topUpAccount',
            component: () => import('@/views/brandManage/topUpAccount'),
            meta: { title: '支付宝充值帐户配置' , keepAlive: false, permission: ['queryBrandTopUpAccount','updateBrandTopUpAccount']}
          },
          {
            path: '/brandManage/aliWapPayAccount',
            name: 'aliWapPayAccount',
            component: () => import('@/views/brandManage/aliWapPayAccount'),
            meta: { title: '支付宝WAP支付账户' , keepAlive: false, permission: ['queryBrandAliWAPPayAccount','updateBrandAliWAPPayAccount']}
          },
          
        ]
      },
      // 个人信息
      // {
      //   path: '/userInfo',
      //   name: 'userInfo',
      //   component: PageView,
      //   meta: { title: '个人信息' , keepAlive: false, icon: 'user', permission: ['queryExternalMerchantInfo','updatePassword','updateBrandTopUpAccount']},
      //   children: [
      //     // {
      //     //   path: '/user/userInfo',
      //     //   name: 'userUserInfo',
      //     //   component: () => import('@/views/user/UserInfo'),
      //     //   meta: { title: '个人信息' , keepAlive: false, permission: ['queryExternalMerchantInfo']}
      //     // },
      //     {
      //       path: '/user/userAccountHistory',
      //       name: 'userAccountHistory',
      //       component: () => import('@/views/user/userAccountHistory'),
      //       meta: { title: '余额变动历史' , keepAlive: false, permission: ['queryExternalMerchantInfo']}
      //     },
      //     {
      //       path: '/user/password',
      //       name: 'memPassword',
      //       component: () => import('@/views/member/password'),
      //       meta: { title: '修改密码' , keepAlive: false, permission: ['updatePassword']}
      //     },
      //     {
      //       path: '/user/topUpAccount',
      //       name: 'topUpAccount',
      //       component: () => import('@/views/user/topUpAccount'),
      //       meta: { title: '充值账户管理' , keepAlive: false, permission: ['updateBrandTopUpAccount']}
      //     },
      //   ]
      // },
      // 权限管理
      {
        path: '/power',
        name: 'power',
        component: PageView,
        meta: { title: '权限管理' , keepAlive: false, icon: 'lock', permission: ['updateRoleUser','setUserIgnorePassword']},
        children: [
          {
            path: '/power/developmentLogin',
            name: 'developmentLogin',
            component: () => import('@/views/power/developmentLogin'),
            meta: { title: '测试人员登录账号' , keepAlive: false, permission: ['setUserIgnorePassword']}
          },
          {
            path: '/power/uploadOss',
            name: 'uploadOss',
            component: () => import('@/views/power/uploadOss'),
            meta: { title: '文件生成链接' , keepAlive: false, permission: ['uploadBrandFile']}
          },
          {
            path: '/power/roles',
            name: 'roles',
            component: () => import('@/views/power/roles/layout'),
            meta: { title: '角色权限配置' , keepAlive: false, permission: ['updateRoleUser','updateRoleResource','updateRoleName','updateResourceGroup','updateResource']},
            redirect: '/power/roles/resourceGroup',
            children: [
              {
                path: '/power/roles/userRole',
                name: 'userRole',
                component: () => import('@/views/power/roles/userRole'),
                meta: { title: '已配置角色用户' , keepAlive: false, permission: ['updateRoleUser']}
              },
              {
                path: '/power/roles/roleResource',
                name: 'roleResource',
                component: () => import('@/views/power/roles/roleResource'),
                meta: { title: '角色资源配置' , keepAlive: false, permission: ['updateRoleResource']}
              },
              {
                path: '/power/roles/role',
                name: 'role',
                component: () => import('@/views/power/roles/role'),
                meta: { title: '角色配置' , keepAlive: false, permission: ['updateRoleName']}
              },
              {
                path: '/power/roles/resourceGroup',
                name: 'resourceGroup',
                component: () => import('@/views/power/roles/resourceGroup'),
                meta: { title: '资源组配置' , keepAlive: false, permission: ['updateResourceGroup']}
              },
              {
                path: '/power/roles/resource',
                name: 'resource',
                component: () => import('@/views/power/roles/resource'),
                meta: { title: '资源配置' , keepAlive: false, permission: ['updateResource']}
              },
            ]
          },
        ]
      },
    ]
  },
  {
    path: '*',
    redirect: '/404',
    hidden: true
  }
]

/**
 * 基础路由
 * @type { *[] }
 */
export const constantRouterMap = [
  {
    path: '/user',
    component: UserLayout,
    redirect: '/user/login',
    hidden: true,
    children: [
      {
        path: 'login',
        name: 'login',
        component: () => import(/* webpackChunkName: "user" */ '@/views/user/Login')
      },
      {
        path: 'register',
        name: 'register',
        component: () => import(/* webpackChunkName: "user" */ '@/views/user/Register')
      },
      {
        path: 'recover',
        name: 'recover',
        component: undefined
      }
    ]
  },

  {
    path: '/404',
    component: () => import(/* webpackChunkName: "fail" */ '@/views/exception/404')
  }
]
